package com.barks.learning.base.async;

import org.springframework.stereotype.Component;
import org.springframework.web.context.request.async.DeferredResult;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author chenw-i
 * @version 1.0.0
 * @ClassName DeferredResultHolder.java
 * @Description TODO
 * @createTime 2020年07月11日 10:03:00
 */
@Component
public class DeferredResultHolder {
   private Map<String, DeferredResult> map = new ConcurrentHashMap<String, DeferredResult>();

    public DeferredResult getDeferredResult(String task) {
        return map.get(task);
    }

    public void putDeferredResult(String task, DeferredResult result) {
        this.map.put(task,result);
    }
}
